﻿<Window x:Class="DataBinding.ItemsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DataBinding"
    Title="ItemsControl" Height="153" Width="289">
    <Window.Resources>

        <Style TargetType="{x:Type ListBoxItem}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=LastName}" Value="Bauer">
                    <Setter Property="Foreground" Value="Red" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

    </Window.Resources>
    <Grid DataContext="{x:Static local:Data.People}">
        <ListBox ItemsSource="{Binding}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=FirstName}" FontSize="16" />
                        <TextBlock Text="{Binding Path=LastName}"  FontSize="16" Margin="3.5,0,7,0" />
                        <TextBlock Text="{Binding Path=Birthday, StringFormat=d}" FontSize="16" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Window>
